package org.dxw.resp;

import lombok.Data;
import org.dxw.common.enums.GlobalResultEnum;

import java.util.List;

/**
 * @description:
 * @author: dxw
 * @create: 2022-04-04 23:34
 **/

@Data
public class PageResponse<E> extends BaseResponse<List<E>> {

    public PageResponse(String code, String msg, List<E> data) {
        super(code, msg, data);
    }

    private long total;

    public PageResponse(String code, String msg,List<E> data, long total) {
        super(code, msg, data);
        this.total = total;
    }

    public static <T> PageResponse<T> success(List<T> data, long total) {
        return new PageResponse(GlobalResultEnum.SUCCESS.getCode(), GlobalResultEnum.SUCCESS.getMsg(), data, total);
    }



}